﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Aunt : RelationBase
    {
        private static Aunt _singleton = new Aunt();
        public static Aunt Instance
        {
            get { return _singleton; }
        }

        private Aunt() { }

        public override bool IsRelated(Person a, Person b)
        {
            // b is a's Aunt IFF b is female AND one of a's parents is b's sibling
            return (b.Sex == Sex.Female &&
                (b.KnownRelation(Sibling.Instance, a.Mother) ||
                b.KnownRelation(Sibling.Instance, a.Father)));
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Sibling.Instance, Mother.Instance, Father.Instance });
        }
    }
}
